<?php
	session_start();
	include_once "classes/thichbaiviet_bs.php";
	
	$MaBaiViet = $_POST['MaBaiViet'];
	$MaNguoiDung = $_POST['MaNguoiDung'];
	
	$ThichBaiViet = new thichbaiviet_bs();
	$ThichBaiViet->SetMaBaiViet($MaBaiViet);
	$ThichBaiViet->SetMaNguoiDung($MaNguoiDung);
	date_default_timezone_set('Asia/Ho_Chi_Minh');
	$ThichBaiViet->SetThoiGian(date('y-m-d h:i:s a', time()));
	
	$result = $ThichBaiViet->Them();
	if($result)
		header('Location: ' . $_SERVER['HTTP_REFERER']);
	else
	{
		$_SESSION['ThongBao'] = "Đã có lỗi xảy ra trong thao tác Theo dõi bài viết.";
		header("Location: index.php?action=component/thongbao");
	}
?>